// -*- C++ -*-
#ifndef SFILE_H
#define SFILE_H

#include <string>

#include "sdataset.h"
#include "sattribute.h"

namespace sds {

  class SFile {
  public:

    enum OpenMode {
      READ,
      WRITE,
      CREATE
    };


    SFile(const std::string&, OpenMode mode = READ);
    SFile(const char*, OpenMode mode = READ);
    ~SFile();

    SInteger getDatasetCount() const { return dataset; }

    SDataset getDataset(int index) const { 
      return SDataset(fileId, index); 
    }

    SDataset getDataset(const std::string& name) const;

    SDataset createDataset(const std::string& name, SDataType type,
			   const std::vector<SInteger>& size);

    SInteger getAttributeCount() const { return attribute; }

    SAttribute getAttribute(int index) const { 
      return SAttribute(fileId, index); 
    }

    SAttribute getAttribute(const std::string& name) const;

  private:
    SInteger fileId;

    SInteger dataset;
    SInteger attribute;
  };

}
#endif
